package club.xyes.zkh.ecommerce.service;

import club.xyes.zkh.ecommerce.commons.entity.Shop;
import club.xyes.zkh.ecommerce.commons.entity.ShopMembership;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;

/**
 * Create by 郭文梁 2019/4/18 0018 14:40
 * ShopMembershipService
 * 商铺会员定义相关业务行为定义
 *
 * @author 郭文梁
 * @data 2019/4/18 0018
 */
public interface ShopMembershipService extends BaseService<ShopMembership> {
    /**
     * 通过商铺查找会员信息
     *
     * @param shop 商铺
     * @return 会员信息列表
     */
    List<ShopMembership> findByShop(Shop shop);

    /**
     * 判断商家是否已经创建过会员卡
     *
     * @param shop 商铺
     * @return 实否已创建
     */
    boolean existsByShop(Shop shop);

    /**
     * 设置会员卡图片
     *
     * @param shopMembership 会员卡对象
     * @param imageFile      图片文件
     * @return ShopMembership
     * @throws IOException IO异常
     */
    ShopMembership setImage(ShopMembership shopMembership, MultipartFile imageFile) throws IOException;

    /**
     * 根据ID查询会员卡信息
     *
     * @param id 会员卡ID
     * @return 会员卡信息
     */
    ShopMembership getRequiredByIdFetchAll(Integer id);

    /**
     * 创建默认会员卡
     *
     * @param shop 商铺对象
     * @return 会员卡
     */
    ShopMembership createDefault(Shop shop);
}
